import { clearWorkTypeMap, clearExecuteTypeMap } from '@/config/dict'
import { parseTime } from '@/utils'

export const tableColumn = [
  {
    key: 'type',
    label: '排班类别',
    minWidth: 120,
    render: (_, rocord) => clearWorkTypeMap.find(e => e.key === rocord.row.type).value
  },
  {
    key: 'name',
    label: '任务名称',
    minWidth: 80
  },

  {
    key: 'beginDate',
    label: '任务时间',
    minWidth: 200,
    render: (_, rocord) => parseTime(rocord.row.beginDate, 'YYYY-MM-DD') + ' 至 ' + parseTime(rocord.row.endDate, 'YYYY-MM-DD')
  },
  {
    key: 'executeType',
    label: '排班类型',
    minWidth: 80,
    render: (_, rocord) => clearExecuteTypeMap.find(e => e.key === rocord.row.executeType).value
  },
  {
    key: 'componentName',
    label: '作业部件',
    minWidth: 180
  },
  {
    key: 'content',
    label: '作业内容',
    minWidth: 180
  },
  {
    key: 'openDate',
    label: '开放时间',
    minWidth: 100
  },
  {
    key: 'routeDesc',
    label: '路线描述',
    minWidth: 100
  },
  {
    key: 'recordCount',
    label: '子任务数量',
    minWidth: 100
  },
  {
    key: 'createTime',
    label: '创建时间',
    minWidth: 160,
    render: (_, rocord) => parseTime(rocord.row.createTime)
  }

]

export const tableSearch = [
  // {
  //   label: '类型',
  //   type: 'select',
  //   key: 'type',
  //   options: clearWorkTypeMap
  // },
  {
    label: '部件',
    type: 'select',
    key: 'componentId',
    options: []
  },
  {
    label: '开始时间',
    type: 'date',
    key: 'beginDate'
  },
  {
    label: '结束时间',
    type: 'date',
    key: 'endDate'
  }
]
